<template>
  <div class="box">
    <div class="bg">
      <video src="../../assets/bg.mp4" loop autoplay muted></video>
    </div>
    <!-- 二维码角标 -->
    <div class="content">
      <svg
        class="icon"
        aria-hidden="true"
        id="erweima"
        v-if="!flag"
        @click="isShow"
      >
        <use xlink:href="#icon-erweimajiaobiao"></use>
      </svg>
      <!-- 电脑角标 -->
      <svg
        class="icon"
        id="icondiannao"
        aria-hidden="true"
        v-else
        @click="isShow"
      >
        <use xlink:href="#icon-diannaojiaobiao"></use>
      </svg>
      <h1>{{ obj.title }}</h1>

      <!-- 常规登陆组件 -->
      <commonLogin v-if="!flag"></commonLogin>
      <!-- 二维码登入组件 -->
      <smsLogin v-else></smsLogin>
      <div class="toggle">
        <svg class="icon" aria-hidden="true" @click="isShow">
          <use :xlink:href="Con"></use>
        </svg>
        <b @click="isShow">{{ obj.content }}</b>
      </div>
    </div>
  </div>
</template>

<script setup>
import commonLogin from './commonLogin.vue';
import smsLogin from './sms.vue';
import { ref, computed } from 'vue';
//控制组件显示隐藏
let flag = ref(false);
//创建一个对象保存h1 和b 标签的文字信息
let obj = ref({
  title: '后台登入系统',
  content: '点击切换手机登入'
});
//切换登入方式
let isShow = () => {
  flag.value = !flag.value;
  if (flag.value) {
    obj.value.title = '短信登入';
    obj.value.content = '切换账户密码登陆';
  } else {
    obj.value.title = '后台登入系统';
    obj.value.content = '点击切换手机登入';
  }
  // console.log(flag);
};
let Con = computed(() => {
  return flag.value ? '#icon-icon-test' : '#icon-iphone';
});
</script>

<style lang="scss" scoped>
.el-form-item__content {
  .el-input {
    width: 200px;
  }
}
.el-form--default {
  width: 400px;
  height: 500px;
  padding-top: 189px;
  box-sizing: border-box;
}
.content {
  z-index: 111;
  position: absolute;
  top: 250px;
  right: 100px;
  width: 420px;
  height: 500px;
  background-color: rgba(0, 0, 0, 0.2);
  padding-right: 55px;
}
h1 {
  position: fixed;
  top: 357px;
  right: 243px;
  z-index: 112;
  color: white;
  // margin-bottom: 40px;
}
video {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
.el-form .el-form-item {
  color: red !important;
  // font-size: 20px;
  // font-weight: 900;
}
.toggle > .icon {
  width: 40px;
  height: 40px;
  vertical-align: middle;
  cursor: pointer;
}
.toggle {
  position: absolute;
  bottom: 46px;
  right: 160px;
}

#icondiannao {
  z-index: 118;
  width: 60px;
  height: 60px;
  position: absolute;
  top: -1px;
  right: -1px;
  cursor: pointer;
}
#erweima {
  cursor: pointer;
  z-index: 118;
  width: 60px;
  height: 60px;
  position: absolute;
  top: -1px;
  right: -1px;
}
b {
  cursor: pointer;
  user-select: none;
}
</style>
